<template>
	<view>
		<view class="width flex justify-content m-t7 input-goods">{{message.time}}</view>
		<view class="m-item" :id="'message'+id">
			
			<view class="m-left">
				<image class="head_icon border-r1 m-r1" :src="message.avatar" v-if="message.user=='home'"></image>
			</view>
			
			<view class="m-content">
				<view class="m-content-head" :class="{'m-content-head-right':message.user=='customer'}">
					<view :class="'m-content-head-'+message.user">{{message.content}}</view>
					
				</view>
				
			</view>
			
			<view class="m-right">
				<image class="head_icon border-r1 ml-2" :src="message.avatar" v-if="message.user=='customer'"></image>
			</view>
			
		</view>
	</view>
</template>

<script>
	import {
		mapState
	} from 'vuex'

	export default {
		data() {
			return {
				abosultPaht: "../../"
			}
		},
		props: ['message', 'id'],
		computed: mapState(['user'])
	}
</script>

<style>
	.m-item {
		display: flex;
		flex-direction: row;
		padding-top: 40px;
	}
	.m-left {
		display: flex;
		width: 160rpx;
		justify-content: center;
		align-items: flex-start;
	}
	.m-content {
		display: flex;
		flex: 1;
		flex-direction: column;
		justify-content: center;
		word-break: break-all;
	}
	.m-right {
		display: flex;
		width: 160rpx;
		justify-content: center;
		align-items: flex-start;
	}
	.head_icon {
		width: 90rpx;
		height: 90rpx;
	}
	.m-content-head {
		position: relative;
		top: 18rpx;
		display: flex;
		justify-content: flex-start;
	}
	.m-content-head-right {
		display: flex;
		justify-content: flex-end;
	}
	
	.m-content-head-home {
		text-align: left;
		background: #FFFFFF;
		border: 1px #FFFFFF solid;
		border-radius: 10px;
		padding: 7px 10px;
		color: #333333;
		line-height: 1.5;
	}
	.m-content-head-home:before {
		border: 8px solid transparent;
		border-right: 15px solid #FFFFFF;
		left: -20px;
		top: 15rpx;
		width: 0;
		height: 0;
		position: absolute;
		content: ' '
	}
	.m-content-head-customer {
		border: 1px white solid;
		background: white;
		border-radius: 10px;
		padding: 7px 10px;
	}
	.m-content-head-customer:after {
		border: 8px solid transparent;
		border-left: 15px solid white;
		top: 15rpx;
		right: -20px;
		width: 0;
		height: 0;
		position: absolute;
		content: ' '
	}
</style>
